dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d2a1ba5
)
Added isatty() check to readconsole()
author
Tim Starling
<tstarling@users.mediawiki.org>
Thu, 8 Sep 2005 08:49:04 +0000
(08:49 +0000)
committer
Tim Starling
<tstarling@users.mediawiki.org>
Thu, 8 Sep 2005 08:49:04 +0000
(08:49 +0000)
install-utils.inc
patch
|
blob
|
history
diff --git
a/install-utils.inc
b/install-utils.inc
index
faabab6
..
6de9377
100644
(file)
--- a/
install-utils.inc
+++ b/
install-utils.inc
@@
-57,10
+57,18
@@
function copydirectory( $source, $dest ) {
}
function readconsole( $prompt = '' ) {
- if ( function_exists( 'readline' ) ) {
+ if ( function_exists( 'posix_isatty' ) && posix_isatty( STDIN ) ) {
+ $isatty = true;
+ } else {
+ $isatty = false;
+ }
+
+ if ( $isatty && function_exists( 'readline' ) ) {
return readline( $prompt );
} else {
- print $prompt;
+ if ( $isatty ) {
+ print $prompt;
+ }
$fp = fopen( 'php://stdin', 'r' );
$st = fgets($fp, 1024);
if ($st === false) return false;